<?php

declare (strict_types=1);

namespace magein\think\pay;

use magein\pay\extension\PayLogInterface;
use think\facade\Log;

class PayLog implements PayLogInterface
{

    /**
     * 通知渠道结果日志
     * @param $status_code
     * @param $content
     * @param array $pay_order
     * @return void
     */
    public function notice($status_code, $content, array $pay_order = [])
    {
        $pay_no = $pay_order['pay_no'] ?? '';
        $order_no = $pay_order['order_no'] ?? '';
        $trade_no = $pay_order['trade_no'] ?? '';
        $message = <<<EOF
=============notice=============
  pay_no:$pay_no
  order_no:$order_no
  trade_no:$trade_no
  response:
    status_code:$status_code
    content:$content

EOF;
        Log::channel('pay')->debug($message);
    }

    /**
     * debug日志
     * @param $message
     * @return void
     */
    public function debug($message)
    {
        Log::channel('pay')->debug($message);
    }
}